<?php
include_once("Data/MySQLDAO.php");
include("SignupSlotsBean.php");

class SignupSlotsDAO extends MySQLDAO {
	protected function lookupSqlById($id) {
		switch($id) {
			case "SELECT":
				return "select event_id,slot_datetime from signup_slots  <<ADD WHERE CLAUSE>>";
				break;
			case "INSERT":
				return "insert into signup_slots (event_id,slot_datetime) values (?,?)";
				break;
			case "UPDATE":
				return "update signup_slots set event_id = ?,slot_datetime = ?  <<ADD WHERE CLAUSE>>";
				break;
			case "DELETE":
				return "delete from signup_slots  <<ADD WHERE CLAUSE>>";
				break;
			default:
				return;
				break;
		}
	}

	protected function bindParameters($id,$paramBean) {
		switch($id) {
			case "SELECT":
				break;
			case "INSERT":
				$params[0] = $this->bindInt($paramBean->getEventId());
				$params[1] = $this->bindDate($paramBean->getSlotDatetime());
				break;
			case "UPDATE":
				break;
			case "DELETE":
				break;
		}
		return $params;
	}

	protected function loadBean($id,$row,$rows) {
		$bean = new SignupSlotsBean();
		switch($id) {
			case "SELECT":
				$bean->setEventId($row['event_id']);
				$bean->setSlotDatetime($row['slot_datetime']);
				break;
		}
		array_push($rows,$bean);
		return $rows;
	}

	protected function getDbPropertiesFile($file="") {
    	try {
			parent::getDbPropertiesFile();
        }
		catch(Exception $e) {
			print('<br><br><span style="color:red;">There was an error loading the properties file!!</span>');
	        exit();
        }
	}
}
?>
